package com.agu.mgt.spmgt.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.agu.utils.Query;

import java.util.List;
import java.util.Map;

import com.agu.mgt.spmgt.dao.EntSpDao;
import com.agu.entity.spmgt.EntSpEntity;
import com.agu.mgt.spmgt.service.EntSpService;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;


@Service("entSpService")
@Transactional(readOnly = true)
public class EntSpService{
	@Autowired
	private EntSpDao entSpDao;
	
	
	public EntSpEntity queryObject(Long spId){
		return entSpDao.queryObject(spId);
	}
	
	
	public List<EntSpEntity> queryList(Map<String, Object> map){
		return entSpDao.queryList(map);
	}

    
	public Page<EntSpEntity> queryPageList(Query query){
	    PageHelper.startPage(query.getPage(), query.getLimit());
	    return entSpDao.queryPageList(query);
	}
	
	
	public int queryTotal(Map<String, Object> map){
		return entSpDao.queryTotal(map);
	}
	
	
	@Transactional
	public void save(EntSpEntity entSp){
		entSpDao.save(entSp);
	}
	
	
	@Transactional
	public void update(EntSpEntity entSp){
		entSpDao.update(entSp);
	}
	
	
	@Transactional
	public void delete(Long spId){
		entSpDao.delete(spId);
	}
	
	
	@Transactional
	public void deleteBatch(Long[] spIds){
		entSpDao.deleteBatch(spIds);
	}
}
